#include<bits/stdc++.h>
using namespace std;
int t,tt;
int cnt[100];
bool _is(int n){
	int flag = 0;
	for(int i = 2;i <= sqrt(n);i++){
		//不是素数
		if(n % i == 0){
			flag = 1;
		}
	}
	if(flag) return false;
	return true;
}
void solve(){
	memset(cnt,0,sizeof(cnt));
	string n;
	int k;
	cin >> k;
	cin >> n;
	for(int i = 0;i < k;i++){
		int temp = n[i] - '0';
		cnt[temp]++;
		if(temp == 1 || temp == 4 || temp == 6 || temp == 8 || temp == 9){
			cout << 1 << "\n" << temp << "\n";
			return;
		}
	}
	//2 3 5 7的情况
	cout << 2 << "\n";
	for(int i = 0;i < k;i++){
		for(int j = i + 1;j < k;j++){
			int num = (n[i] - '0') * 10 + n[j] - '0';
			if(!_is(num)){
				cout << num << "\n";
				return;
			}
		}
	}
	
}
int main(){
	cin >> t;
	tt = t;
	while(tt--) solve();
}